Make interpretation of misc->xpad/ypad consistent with GtkLabel. Do
authorOwen Taylor <otaylor@redhat.com>
Thu, 27 Dec 2001 21:42:02 +0000 (21:42 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 27 Dec 2001 21:42:02 +0000 (21:42 +0000)
Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
        of misc->xpad/ypad consistent with GtkLabel. Do
        directional flipping when interpreting misc->xalign/yalign.
        Fix off-by-one error for negative x,y. (#67472, reported
        by Mathieu Lacage)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkarrow.c
gtk/gtkimage.c
gtk/gtkpixmap.c

index 52b73b827f0f3d1c5d7d3cc06cbb9725af464005..c58dac649b583b0c036e2550f14ab8c2732b40bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
+       of misc->xpad/ypad consistent with GtkLabel. Do 
+       directional flipping when interpreting misc->xalign/yalign.
+       Fix off-by-one error for negative x,y. (#67472, reported
+       by Mathieu Lacage)
+
 Thu Dec 27 15:45:41 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_set_style_internal):
index 52b73b827f0f3d1c5d7d3cc06cbb9725af464005..c58dac649b583b0c036e2550f14ab8c2732b40bc 100644 (file)
@@ -1,3 +1,11 @@
+Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
+       of misc->xpad/ypad consistent with GtkLabel. Do 
+       directional flipping when interpreting misc->xalign/yalign.
+       Fix off-by-one error for negative x,y. (#67472, reported
+       by Mathieu Lacage)
+
 Thu Dec 27 15:45:41 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_set_style_internal):
index 52b73b827f0f3d1c5d7d3cc06cbb9725af464005..c58dac649b583b0c036e2550f14ab8c2732b40bc 100644 (file)
@@ -1,3 +1,11 @@
+Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
+       of misc->xpad/ypad consistent with GtkLabel. Do 
+       directional flipping when interpreting misc->xalign/yalign.
+       Fix off-by-one error for negative x,y. (#67472, reported
+       by Mathieu Lacage)
+
 Thu Dec 27 15:45:41 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_set_style_internal):
index 52b73b827f0f3d1c5d7d3cc06cbb9725af464005..c58dac649b583b0c036e2550f14ab8c2732b40bc 100644 (file)
@@ -1,3 +1,11 @@
+Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
+       of misc->xpad/ypad consistent with GtkLabel. Do 
+       directional flipping when interpreting misc->xalign/yalign.
+       Fix off-by-one error for negative x,y. (#67472, reported
+       by Mathieu Lacage)
+
 Thu Dec 27 15:45:41 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_set_style_internal):
index 52b73b827f0f3d1c5d7d3cc06cbb9725af464005..c58dac649b583b0c036e2550f14ab8c2732b40bc 100644 (file)
@@ -1,3 +1,11 @@
+Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
+       of misc->xpad/ypad consistent with GtkLabel. Do 
+       directional flipping when interpreting misc->xalign/yalign.
+       Fix off-by-one error for negative x,y. (#67472, reported
+       by Mathieu Lacage)
+
 Thu Dec 27 15:45:41 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_set_style_internal):
index 52b73b827f0f3d1c5d7d3cc06cbb9725af464005..c58dac649b583b0c036e2550f14ab8c2732b40bc 100644 (file)
@@ -1,3 +1,11 @@
+Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
+       of misc->xpad/ypad consistent with GtkLabel. Do 
+       directional flipping when interpreting misc->xalign/yalign.
+       Fix off-by-one error for negative x,y. (#67472, reported
+       by Mathieu Lacage)
+
 Thu Dec 27 15:45:41 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_set_style_internal):
index 52b73b827f0f3d1c5d7d3cc06cbb9725af464005..c58dac649b583b0c036e2550f14ab8c2732b40bc 100644 (file)
@@ -1,3 +1,11 @@
+Thu Dec 27 16:05:30 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation
+       of misc->xpad/ypad consistent with GtkLabel. Do 
+       directional flipping when interpreting misc->xalign/yalign.
+       Fix off-by-one error for negative x,y. (#67472, reported
+       by Mathieu Lacage)
+
 Thu Dec 27 15:45:41 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_set_style_internal):
index c859297c945ab9200fe0c9a5423b19364c8a9a20..cb27a51dd870ccfc3267efa2aac90ba6887b8961 100644 (file)
@@ -24,6 +24,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <math.h>
 #include "gtkarrow.h"
 #include "gtkintl.h"
 
@@ -231,6 +232,7 @@ gtk_arrow_expose (GtkWidget      *widget,
   gint width, height;
   gint x, y;
   gint extent;
+  gfloat xalign;
 
   g_return_val_if_fail (widget != NULL, FALSE);
   g_return_val_if_fail (GTK_IS_ARROW (widget), FALSE);
@@ -245,11 +247,18 @@ gtk_arrow_expose (GtkWidget      *widget,
       height = widget->allocation.height - misc->ypad * 2;
       extent = MIN (width, height);
 
-      x = ((widget->allocation.x + misc->xpad) * (1.0 - misc->xalign) +
-          (widget->allocation.x + widget->allocation.width - extent - misc->xpad) * misc->xalign);
-      y = ((widget->allocation.y + misc->ypad) * (1.0 - misc->yalign) +
-          (widget->allocation.y + widget->allocation.height - extent - misc->ypad) * misc->yalign);
-
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+       xalign = misc->xalign;
+      else
+       xalign = 1.0 - misc->xalign;
+  
+      x = floor (widget->allocation.x + misc->xpad
+                + ((widget->allocation.width - extent) * xalign)
+                + 0.5);
+      y = floor (widget->allocation.y + misc->ypad 
+                + ((widget->allocation.height - extent) * misc->yalign)
+                + 0.5);
+      
       shadow_type = arrow->shadow_type;
 
       if (widget->state == GTK_STATE_ACTIVE)
index 7c8bebc5b54c3a783e98d5d4cedc07b5d5c0b21f..d601ed15c8830760420d6fad9298d7438f9a054a 100644 (file)
@@ -24,6 +24,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <math.h>
 #include "gtkcontainer.h"
 #include "gtkimage.h"
 #include "gtkiconfactory.h"
@@ -1202,6 +1203,7 @@ gtk_image_expose (GtkWidget      *widget,
       GtkImage *image;
       GtkMisc *misc;
       GdkRectangle area, image_bound;
+      gfloat xalign;
       gint x, y;
       GdkBitmap *mask = NULL;
       GdkPixbuf *stock_pixbuf = NULL;
@@ -1209,15 +1211,18 @@ gtk_image_expose (GtkWidget      *widget,
       image = GTK_IMAGE (widget);
       misc = GTK_MISC (widget);
 
-      x = (widget->allocation.x * (1.0 - misc->xalign) +
-          (widget->allocation.x + widget->allocation.width
-           - (widget->requisition.width - misc->xpad * 2)) *
-          misc->xalign) + 0.5;
-      y = (widget->allocation.y * (1.0 - misc->yalign) +
-          (widget->allocation.y + widget->allocation.height
-           - (widget->requisition.height - misc->ypad * 2)) *
-          misc->yalign) + 0.5;
-
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+       xalign = misc->xalign;
+      else
+       xalign = 1.0 - misc->xalign;
+  
+      x = floor (widget->allocation.x + misc->xpad
+                + ((widget->allocation.width - widget->requisition.width) * xalign)
+                + 0.5);
+      y = floor (widget->allocation.y + misc->ypad 
+                + ((widget->allocation.height - widget->requisition.height) * misc->yalign)
+                + 0.5);
+      
       image_bound.x = x;
       image_bound.y = y;      
 
index 109b68cc487a8bfa0de321a3248fec47bec9c829..d887e082eb123dba0566e444463f77334c4d448c 100644 (file)
@@ -27,6 +27,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <math.h>
 #include "gtkcontainer.h"
 #include "gtkpixmap.h"
 
@@ -190,6 +191,7 @@ gtk_pixmap_expose (GtkWidget      *widget,
   GtkPixmap *pixmap;
   GtkMisc *misc;
   gint x, y;
+  gfloat xalign;
 
   g_return_val_if_fail (GTK_IS_PIXMAP (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
@@ -199,15 +201,18 @@ gtk_pixmap_expose (GtkWidget      *widget,
       pixmap = GTK_PIXMAP (widget);
       misc = GTK_MISC (widget);
 
-      x = (widget->allocation.x * (1.0 - misc->xalign) +
-          (widget->allocation.x + widget->allocation.width
-           - (widget->requisition.width - misc->xpad * 2)) *
-          misc->xalign) + 0.5;
-      y = (widget->allocation.y * (1.0 - misc->yalign) +
-          (widget->allocation.y + widget->allocation.height
-           - (widget->requisition.height - misc->ypad * 2)) *
-          misc->yalign) + 0.5;
-
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+       xalign = misc->xalign;
+      else
+       xalign = 1.0 - misc->xalign;
+  
+      x = floor (widget->allocation.x + misc->xpad
+                + ((widget->allocation.width - widget->requisition.width) * xalign)
+                + 0.5);
+      y = floor (widget->allocation.y + misc->ypad 
+                + ((widget->allocation.height - widget->requisition.height) * misc->yalign)
+                + 0.5);
+      
       if (pixmap->mask)
        {
          gdk_gc_set_clip_mask (widget->style->black_gc, pixmap->mask);